PTDispatcher Class Reference

Inherits from NSObject
Declared in PTDispatcher.h

Overview

主要功能:实现 SDK 和打印机的通讯,主要是BLE 蓝牙和 WiFi 两种方式通讯

– sendData:

send to Printer with NSData

- (void)sendData:(NSData *)data

Declared In

PTDispatcher.h

– sendDataQueue:

You just need to create several NSData object in a NSArray, then it will send to print one by one. 将需要的一组数据(NSData)加入 NSArray,将会依次打印出来。

- (void)sendDataQueue:(NSArray *)dataQueue

Parameters

dataQueue

like @[data1,data2,data3]

Declared In

PTDispatcher.h

– disConnectCurrentLine

取消当前连接(Wifi 或者 BLE)

- (void)disConnectCurrentLine

Declared In

PTDispatcher.h

– scanBluetooth

扫描蓝牙

- (void)scanBluetooth

Declared In

PTDispatcher.h

– stopScanBluetooth

停止扫描蓝牙

- (void)stopScanBluetooth

Declared In

PTDispatcher.h

– connectBluetooth:

连接蓝牙

- (void)connectBluetooth:(CBPeripheral *)peripheral

Declared In

PTDispatcher.h

– disConnectBluetooth

断开连接蓝牙

- (void)disConnectBluetooth

Declared In

PTDispatcher.h

– setBLEDelegate:

设置 BLE 代理

- (void)setBLEDelegate:(id)someone

Declared In

PTDispatcher.h

– setWiFiDelegate:

设置 WiFi 代理

- (void)setWiFiDelegate:(id)someone

Declared In

PTDispatcher.h

– generateDistanceWithRSSI:

根据 rssi 强度计算距离

- (NSString *)generateDistanceWithRSSI:(int)rssi

Parameters

rssi

信号强度

a

发射端和接收端相隔1米时的信号强度

n

环境衰减因子

Declared In

PTDispatcher.h

– getRouterInfo

获取当前 Wifi 的路由信息

- (NSDictionary *)getRouterInfo

Return Value

路由信息字典

Declared In

PTDispatcher.h

– connectWiFi:

通过 ip 地址连接 wifi

- (void)connectWiFi:(NSString *)ip

Declared In

PTDispatcher.h

– isEscPosInstruction:

判断是否是 ESC—POS 指令集

- (BOOL)isEscPosInstruction:(NSString *)name

Declared In

PTDispatcher.h

– isTscTsplInstrution:

判断是否是 TSC-TSPL 指令集

- (BOOL)isTscTsplInstrution:(NSString *)name

Declared In

PTDispatcher.h